All Objects
Date Object
METHOD: Date::parse
Date.
parse
(dateString)
This method takes a date string an returns the number of milliseconds since January 01 1970 00:00:00, according to local time. It accepts the standard date syntax, e.g. "Friday, 9 July, 11:10:00 GMT+0130". If a time zone is not specified, this method assumes that the supplied string is local time.
This is a static method of
Date
and, subsequently, the syntax is always
Date.parse()
as opposed to
objectName.parse()
.
The following code uses the
Date.parse
method to set the value of the myDate object to that of the supplied string.
Code:
myDate = new Date()
myDate.setTime(Date.parse("July 3, 1999"))
document.write(myDate)
Output:
Sat Jul 3 00:00:00 UTC+0100 1999
Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information